<template>
	<view>
		<view style="margin: 250rpx 0rpx;text-align: center;"  v-if="followList[0]==null">
			<image src="../../static/zanwu.png" class="img3"></image>
		</view>
		<uni-card v-for="i in followList" @click="go(i.user.userId)">
			<view style="display: flex;justify-content: space-between;">
				<view style="display: flex;">
					<view>
						<image :src="baseUrl+i.user.avatar" class="tx"></image>
					</view>
					<view style="margin-left: 30rpx;">
						<view style="font-size: 36rpx;font-weight: 700;margin-bottom: 20rpx;">{{i.user.nickName}}</view>
						<view style="font-size: 26rpx;">{{i.schoolName}}</view>
					</view>
				</view>
				<view>
					<button type="warn" size="mini" @click.stop="remove(i)">删除</button>
				</view>
			</view>
		</uni-card>
	</view>
</template>

<script>
import { removefollow, selectlist } from '../../api/myapi';
import config from '@/config'
	export default {
		data(){
			return {
				userid:'',
				followList:[],
				baseUrl: config.baseUrl
			}
		},
		methods:{
			go(i){
				console.log(i);
				uni.redirectTo({
					url:'../shop/index?userid=' + i
				})
			},
			async remove(i){
				console.log(i);
				let r = await removefollow({
					userid:i.userid,
					followuserid:i.followuserid
				})
				this.$modal.msg(r.msg)
				this.selectfollow()
			},
			async selectfollow(){
				let n = await selectlist({id:this.userid})
				console.log(n);
				this.followList = n.data
			}
		},
		async onShow(){
			this.userid = uni.getStorageSync('userid')
			console.log(this.userid);
			this.selectfollow()
		}
	}
</script>

<style>
	.tx {
		width: 120rpx;
		height: 120rpx;
		border-radius: 50%;
		background-color: aquamarine;
	}
	.img3 {
		width: 350rpx;
		height: 350rpx;
	}
</style>